home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
CUGUK
/
PC_LIBS
/
C045.ZIP
/
BTREE.ARC
/
CSTRUCT.H
< prev
next >
Wrap
Text File
|
1989-02-01
|
2KB
|
76 lines
#define MAXKEYLEN 25
#define MAXDATARECSIZE 342
#define PAGESIZE 16
#define ORDER 8
#define MAXHEIGHT 5
#define PGRECSTKSIZE 5
#define TRUE 1
#define FALSE 0
typedef char tastring[64];
typedef char takeystr[MAXKEYLEN + 1];
typedef char databuf[MAXDATARECSIZE];
typedef struct {
int numrecs;
int reclen;
int firstfree;
int numberfree;
int rootref;
int dupe;
FILE * fp;
} datafile;
typedef struct {
int dataref;
int pageref;
takeystr key;
} taitem;
typedef struct {
int itemsonpage;
int bckwpageref;
taitem itemarray[PAGESIZE];
} tapage;
typedef struct {
int pageref; /* page we're at. where we're aheading. */
int itemndx; /* legal itemndx range: -1..itemsonpage-1 */
} tasearchstep;
typedef tasearchstep tapath[MAXHEIGHT];
typedef struct {
tapath path;
int pnx;
int rootref;
int keyl;
int allowduplkeys;
datafile * dfp;
} indexfile;
typedef struct {
tapage page;
int pageref;
int updated;
indexfile * nfp;
} tapagerec;
typedef tapagerec tapagerecstack[PGRECSTKSIZE];
typedef int tapagemap[PGRECSTKSIZE];
typedef union {
tapagerec pagerec;
databuf datarec;
int nextfree;
} tarecordbuffer;
/*
* DataRec and PageRec are never referenced by name. This merely insures
* TaRecordBuffer is large enough to accommodate an index page size as well
* as data record size. The integer, i, points to the nextfree record.
*/